package com.whfc.wxmp.api.fvs.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.wxmp.annotation.CurrentWxUser;
import com.whfc.fuum.entity.WxUser;
import com.whfc.fvs.dto.FvsGroupDTO;
import com.whfc.fvs.service.FvsGroupService;
import com.whfc.wxmp.api.fvs.service.WxFvsGroupService;
import com.whfc.wxmp.util.RequestConetxtUtil;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author sun_guodong
 * @description 分组
 * @date 2020-12-17
 */
@RestController
@RequestMapping("/mp/api/fvs/group")
public class WxFvsGroupController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxFvsGroupService wxFvsGroupService;

    @GetMapping("/tree")
    public Result tree(@CurrentWxUser WxUser wxUser,
                       @RequestParam("deptId") Integer deptId) {
        logger.info("WXMPUA|{}|{}|{}|{}|{}",
                wxUser.getId(), RequestConetxtUtil.getAppType(), RequestConetxtUtil.getPage(),
                "视频监控设备列表", RequestConetxtUtil.getParameters());
        List<FvsGroupDTO> data = wxFvsGroupService.tree(deptId);
        return ResultUtil.success(data);
    }
}
